//商品管理-商品分类
App.util.ns('Admin.Goods.GoodsType');
App.pages.add((function(){
    var NS = Admin.Goods.GoodsType;
    var page = new App.Page({
        name: 'goods/goodstype/index'
    });
    //页面初始化
    page.initStack.add('dataTable', function(){
        //面包屑导航
        this.setBreadcrumb([{
            icon: '<i class="fa fa-crosshairs"></i>',
            content: '商品管理'
        }, {
            content: '商品分类'
        }]);
        this.dataTable = new App.DataTable({
            baseUrl: '/admin/goods/goodstype',
            dataUrl: 'lists',
            table: {
                id: 'id',
                main: 0,
                columns: App.util.copy(NS.Conf.columns)
            },
            filter: [
                {type: 'keywords'},
                {type: 'timeRange'},
                {type: 'select', name: 'status', title: '状态', width: '90px', items: [
                    [0, '下线'],
                    [1, '在线']
                ]}
            ],
            menu: [
                {parent: 'add', permission: 'op:admin.goods.goodstype.create'},
                {parent: 'view', permission: 'op:admin.goods.goodstype.detail'},
                {parent: 'edit', permission: 'op:admin.goods.goodstype.update'},
                {type: 'inline', permission: 'op:admin.goods.goodstype.online',
                    name: '上线',
                    operation: {type: 'change', url: 'online'},
                    conditions: [['status', '0']]
                },
                {type: 'inline', permission: 'op:admin.goods.goodstype.offline',
                    name: '下线',
                    operation: {type: 'change', url: 'offline'},
                    conditions: [['status', '1']]
                },
                {parent: 'drop', permission: 'op:admin.goods.goodstype.delete'},
                {parent: 'multiDrop', permission: 'op:admin.goods.goodstype.multiDelete'},
                //{parent: 'oplog', permission: 'op:admin.goods.goodstype.getOpLogs'}
            ],
            detail: {
                form: {
                    items: App.util.copy(NS.Conf.form)
                }
            },
            dragSort:{
                permission: 'op:admin.goods.goodstype.sort',
                url:'sort',
                filed:'sort',
                conditions:[['status', '1']]
            },
        }, page);
        this.dataTable.fix(this.contentContainer);
        this.dataTable.loadData();
    });
    //页面刷新
    page.refreshStack.add('dataTable', function(){
        this.dataTable.loadData(true);
    });
    //页面销毁
    page.destroyStack.add('dataTable', function(){
        this.dataTable.destroy();
    });
    return page;
})());